<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

class RankResource extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'userNum' => $this->username,
            'productSum' => set_decimal($this->getAllGoodsCount()),
            'userName' => $this->company,
            'moneyCnt' => set_decimal($this->getAllMoneyCount()),
        ];
    }
}
